package com.syni.mdd.yhd.common.all.service.impl.tool;

import com.syni.mdd.yhd.common.all.dao.jpa.tool.BmsCityAreaDictDao;
import com.syni.mdd.yhd.common.all.entity.tool.BmsCityAreaDict;
import com.syni.mdd.yhd.common.all.service.impl.BaseService;
import com.syni.mdd.yhd.common.all.service.tool.BmsCityAreaDictService;
import org.apache.commons.collections.CollectionUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @className BmsCityAreaDictServiceImpl
 * @description TOO
 * @Author cfx
 * @DATE 2020/6/19 17:13
 * @VERSION 1.0
 **/
@Service
public class BmsCityAreaDictServiceImpl extends BaseService<BmsCityAreaDict, Integer> implements BmsCityAreaDictService {
    @Autowired
    BmsCityAreaDictDao bmsCityAreaDictDao;

    @Override
    public BmsCityAreaDictDao getBaseDao() {
        return bmsCityAreaDictDao;
    }

    @Override
    public BmsCityAreaDict getByCodeId(String areaCode) {
        List<BmsCityAreaDict> bmsCityAreaDicts = bmsCityAreaDictDao.findByCodeId(areaCode);
        if(CollectionUtils.isNotEmpty(bmsCityAreaDicts)){
            return bmsCityAreaDicts.get(0);
        }
        return null;
    }
}
